import {Pipe, PipeTransform} from '@angular/core';

@Pipe({name: 'filePipe'})
export class FilePipe implements PipeTransform {
  transform(value: number) {
    if ((value / 1024) < 1024) {
      return (value / 1024).toFixed(2) + ' KB';
    } else {
      return (value / 1024 / 1024).toFixed(2) + ' MB';
    }
  }
}

